<!--
 * @Descripttion: 今日劳动力作业概况
 * @version: 
 * @Author: ada.wu
 * @Date: 2025-06-25 23:48:14
 * @LastEditors: ada.wu
 * @LastEditTime: 2025-07-15 23:13:24
-->
<!-- css/amap.css -->

<head>
    <link rel="stylesheet" href="/assets/css/amap.css" media="all">
</head>
<style>
    .layui-icon-delete {
        position: absolute;
        right: 10px;
    }

    /* 数字按钮特殊处理 */
    .label-top .layui-input-wrap .layui-input-number .layui-icon {
        height: 16px;
    }

    .label-top .layui-input-wrap .layui-input-suffix.layui-input-split {
        height: 32px;
        top: 38px;
    }

    /* 特殊处理 */
    .row-edge .layui-form-select .layui-edge {
        margin-top: 0 !important
    }

    .row-edge .layui-form-select.layui-form-selected .layui-edge {
        margin-top: -5px !important
    }

    .total-map {
        height: calc(100vh - 440px);
    }
</style>


<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <div class="layui-form layuimini-form label-top">

            <div class="title-row layuimini-title ">
                <div class="title-left">
                    <h4>
                        <i class="layui-icon layui-icon-return anticon mr-1" id="backBtn"></i>
                        <span id="pageTitle"></span>
                    </h4>
                </div>
                <div class="title-right">
                    <span class="title-right-text">
                        <button class="layui-btn layui-btn-primary layui-btn-sm" lay-on="closeBtn">取消</button>
                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="saveBtn">保存</button>
                    </span>
                </div>
            </div>

            <div class="section">
                <div class="solid p-5">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">工单名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="planName" lay-verify="required" lay-reqtext="工单名称不能为空"
                                        placeholder="请输入" value="" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">请求类</label>
                                <div class="layui-input-block">
                                    <select class="layui-input" lay-append-to="body" placeholder="请选择"
                                        name="businessNames" lay-search>
                                        <option value="1">报事</option>
                                        <option value="2">巡检</option>
                                        <option value="3">其他</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">临时工单积分</label>
                                <div class="layui-input-block">
                                    <input type="text" name="laterTime" lay-verify="required" lay-affix="number"
                                        placeholder="请输入" step="1" min="0" max="100" class="layui-input ">

                                </div>
                            </div>
                        </div>


                        <div class="layui-col-md12">

                            <div class="title-row">
                                <div class="title-left">
                                    <div class="title-info">
                                        <div class="title-line"></div>
                                        <span class="title-text">常规工单</span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">工单积分</label>
                                <div class="layui-input-block">
                                    <input type="text" name="laterTime" lay-verify="required" lay-affix="number"
                                        placeholder="请输入" step="1" min="0" max="100" class="layui-input ">

                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">作业周期</label>
                                <div class="layui-input-block">
                                    <input type="text" name="datePeriodStart" autocomplete="off" id="date_period_start"
                                        class="layui-input" placeholder="请选择">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">作业时间</label>
                                <div class="layui-input-block">
                                    <input type="text" name="datePeriodStart" autocomplete="off" id="date_datetime"
                                        class="layui-input" placeholder="请选择">
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="layui-row layui-col-space10 layui-bg-gray mb-5 p-relative">
                        <div class="layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">工作位置1</label>
                                <div class="layui-input-block">
                                    <input type="text" name="addressName" lay-verify="required" lay-reqtext="工作位置不能为空"
                                        placeholder="请输入" value="" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md8">
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label required">工单要求</label>
                                <div class="layui-input-block">
                                    <textarea name="remark" class="layui-textarea" placeholder="请输入工单要求"></textarea>
                                </div>
                            </div>
                        </div>
                        <span class="layui-icon layui-icon-delete layui-font-20"></span>
                    </div>
                    <div class="layui-row layui-col-space10 layui-bg-gray mb-5 p-relative">
                        <div class="layui-col-md4">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">工作位置2</label>
                                <div class="layui-input-block">
                                    <input type="text" name="addressName" lay-verify="required" lay-reqtext="工作位置不能为空"
                                        placeholder="请输入" value="" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md8">
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label required">工单要求</label>
                                <div class="layui-input-block">
                                    <textarea name="remark" class="layui-textarea" placeholder="请输入工单要求"></textarea>
                                </div>
                            </div>
                        </div>
                        <span class="layui-icon layui-icon-delete layui-font-20"></span>
                    </div>


                </div>
            </div>
        </div>
    </div>
</div>

<script>



    layui.use(['form', 'miniPage', 'miniAMap'], function () {
        var $ = layui.$,
            form = layui.form,
            element = layui.element,
            layer = layui.layer,
            util = layui.util,
            laydate = layui.laydate,
            miniAMap = layui.miniAMap;

        /******************** 事件 start ********************/
        form.render('select');
        form.render();
        // 作业周期
        laydate.render({
            elem: '#date_period_start',
            range: true
        });
        laydate.render({
            elem: '#date_datetime',
            type: 'time',
            range: true
        });

        // 获取存储的数据
        var appData = layui.sessionData('PLAN_ORDER_PARAMS')
        const { dataDto, pageType, orderType } = appData

        if (dataDto) {
            console.log('子页面的值===userInfo', JSON.parse(dataDto))
        }
        const pageTypeMap = { 'add': '创建', 'edit': '编辑' }
        const orderTypeMap = { '1': '按点位积分类', '2': '按路线积分类计件', '3': '普通类计件积分' }
        // 页面加载完成后默认执行一次
        console.log('orderType==', orderTypeMap[orderType])
        $(document).ready(function () {

            $("#pageTitle").html(pageTypeMap[pageType] + orderTypeMap[orderType] + '工单')

        });



        // 地图页面返回事件
        $('#backBtn').on('click', function () {
            miniPage.backPageCreate()
        });
        // 普通事件
        util.on('lay-on', {
            // 关闭弹出层
            "closeBtn": function () {
                miniPage.backPageCreate()

            }
        });

        /******************** 事件 end ********************/


        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index = layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            }, function () {

                // 关闭弹出层
                layer.close(index);

            });


            return false;
        });










    })
</script>